refactor: single-source the host vocabularies shared with the Workbench - #14
Conversation
Adding a host previously meant re-declaring the same literal unions, sets, and label tables across compiler services and Workbench clients. The native host list and labels now live in one browser-safe host-contracts module that the playground service, catalog, request contracts, eval harness names, and Workbench selectors all derive from; MCP App profile ids, labels, and versions come from the existing descriptor registry instead of four parallel copies; and the MCP session target union is one contracts export consumed by both Workbench gates. Behavior is unchanged - every list keeps its previous members and ordering.
|
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44fff25673
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| * Bundle can drive. Every server-side host set, request union, and Workbench | ||
| * selector derives from this list so adding a native host is one edit. | ||
| */ | ||
| export const NATIVE_HOSTS = Object.freeze(['claude', 'codex'] as const); |
There was a problem hiding this comment.
Derive the remaining playground host gates from this list
When a third native host is added here, the catalog and browser schema will accept and display it, but playground-model.ts:182, playground-routes.ts:190, and the service/catalog decoders still explicitly allow only Claude and Codex. The Workbench will consequently clear the advertised selection or the route will reject the generated request, so this is not yet the promised single edit point; those runtime gates should use the shared vocabulary or a shared predicate too.
Useful? React with 👍 / 👎.
Summary
feat/cursor-host-adapter) — this is the "shared server/browser vocabularies" hygiene item: adding a host previously touched ~10 files of duplicated literal unions, sets, and label tables.host-contracts/native-hosts.tsowns the native host list and labels; the playground service/catalog/request contracts, eval harness names, and the Workbench host selector and zod schema all derive from it.mcp-app-profile-descriptors.tsregistry (dropped four parallel copies, including the Workbench label table).claude | codex | cursor | portable) is now one runtime export fromcontracts/mcp-session.ts, consumed by the Workbench route client and session controller gates.Test plan
pnpm test:unit— 1664 passed, 0 failedpnpm typecheck— clean (root + workbench)pnpm lint— clean